var { isPointInPolygon } = require("../Plugins/isPointInPolygon");

function judgmentOn(corowd, newArray) {
  let list = [];
  let errorList = [];
  corowd.forEach((item) => {
    let obj = {};
    obj.lat = item.latitude;
    obj.lng = item.longitude;
    let flag = isPointInPolygon(obj, newArray);
    if (flag == false) {
      errorList.push(item);
    } else {
      list.push(item);
    }
  });
  return { list, errorList }
}

module.exports = judgmentOn;